<script setup>
import { defineProps, defineEmits } from 'vue';
import { ElButton, ElIcon } from 'element-plus';
import { Star, StarFilled } from '@element-plus/icons-vue'; // 使用Element Plus图标

defineProps({
  likes: { type: Number, default: 0 },
  isLiked: { type: Boolean, default: false },
});
defineEmits(['toggleLike']);
</script>

<template>
  <el-button
      @click="$emit('toggleLike')"
      :type="isLiked ? 'danger' : ''"
      plain
      round
  >
    <el-icon :size="16" style="margin-right: 6px;">
      <component :is="isLiked ? StarFilled : Star" />
    </el-icon>
    {{ likes }}
  </el-button>
</template>